import request from '@/config/axios'

/** 代理商信息 */
export interface Agent {
          id: number; // id
          userId?: number; // 用户Id
          level: number; // 级别
          remark: string; // 备注说明
  }

// 代理商 API
export const AgentApi = {
  // 查询代理商分页
  getAgentPage: async (params: any) => {
    return await request.get({ url: `/member/agent/page`, params })
  },

  // 查询代理商详情
  getAgent: async (id: number) => {
    return await request.get({ url: `/member/agent/get?id=` + id })
  },

  // 新增代理商
  createAgent: async (data: Agent) => {
    return await request.post({ url: `/member/agent/create`, data })
  },

  // 修改代理商
  updateAgent: async (data: Agent) => {
    return await request.put({ url: `/member/agent/update`, data })
  },

  // 删除代理商
  deleteAgent: async (id: number) => {
    return await request.delete({ url: `/member/agent/delete?id=` + id })
  },

  /** 批量删除代理商 */
  deleteAgentList: async (ids: number[]) => {
    return await request.delete({ url: `/member/agent/delete-list?ids=${ids.join(',')}` })
  },

  // 导出代理商 Excel
  exportAgent: async (params) => {
    return await request.download({ url: `/member/agent/export-excel`, params })
  }
}
